<?php
class EnvironmentFactory
{
	const LOAD_DEVELOPMENT_CONFIGURATION = 'Development';
	const LOAD_TEST_CONFIGURATION = 'Test';
	const LOAD_STAGE_CONFIGURATION = 'Stage';
	const LOAD_PRODUCTION_CONFIGURATION = 'Production';
	
	static function getEnvironment($forceEnvironment = null)
	{
		require_once('Environment.php');
		require_once('Servers.php');
		$serverEnvironment = Servers::getServers($_SERVER['HTTP_HOST']);

		$environmentClass = (is_null($forceEnvironment))? 'Environment'.$serverEnvironment['environment']:'Environment'.$forceEnvironment;
		require_once($environmentClass.'.php');
		
		return new $environmentClass;
	}
}